#!/bin/bash
#

bash check-network.sh ||  ! echo "skipping online unit tests" || exit 77

# http://code.google.com/p/httrack/issues/detail?id=4&can=1
bash crawl-test.sh --errors 0 --files 4 \
	--found ut.httrack.com/parsing/back5e1f.gif \
	--found ut.httrack.com/parsing/events.html \
	--found ut.httrack.com/parsing/fade230f4.gif \
	--found ut.httrack.com/parsing/fade3860.gif \
	httrack http://ut.httrack.com/parsing/events.html

# http://code.google.com/p/httrack/issues/detail?id=2&can=1
bash crawl-test.sh --errors 0 --files 3 \
	--found ut.httrack.com/parsing/background-image.css \
	--found ut.httrack.com/parsing/background-image.html \
	--found ut.httrack.com/parsing/fade.gif \
	httrack http://ut.httrack.com/parsing/background-image.html

# javascript parsing
bash crawl-test.sh --errors 0 --files 3 \
	--found ut.httrack.com/parsing/back.gif \
	--found ut.httrack.com/parsing/fade.gif \
	--found ut.httrack.com/parsing/javascript.html \
	httrack http://ut.httrack.com/parsing/javascript.html

# handling of + before query string
bash crawl-test.sh --errors 0 --files 6 \
	--found ut.httrack.com/parsing/escaping.html \
	--found "ut.httrack.com/parsing/foo bar30f4.html" \
	--found "ut.httrack.com/parsing/foo bar5e1f.html" \
	--found "ut.httrack.com/parsing/foo+bar+plus3860.html" \
	--found "ut.httrack.com/parsing/foo barae52.html" \
	--found "ut.httrack.com/parsing/foo bar7b30.html" \
	httrack http://ut.httrack.com/parsing/escaping.html

# handling of # encoded in filename
# see http://code.google.com/p/httrack/issues/detail?id=25
bash crawl-test.sh --errors 2 --files 4 \
	--found "ut.httrack.com/parsing/escaping2.html" \
	--found "ut.httrack.com/parsing/++foo++bar++plus++.html" \
	--found "ut.httrack.com/parsing/foo#bar#.html" \
	--found "ut.httrack.com/parsing/foo bar.html" \
	httrack http://ut.httrack.com/parsing/escaping2.html
